#-----------------------------------[知乎：叶枝黎曼]----------------------------
n = int(input())
vis = [False]*n

def dfs(index):
    if index == n:
        res = []
        for i in range(n):
            if vis[i]:
                res.append((str(i + 1)))
        print(' '.join(res))
        return
    vis[index] = True
    dfs(index + 1)
    vis[index] = False
    dfs(index + 1)

dfs(0)
